#include <algorithm>
#include <iostream>
#include <vector>
#define LL long long
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  LL x, y;
  vector<LL> a;

  cin >> n >> x >> y;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  LL w = y * a[0], ans = a[0];

  for (int i = 1; i < n; i++) {
    if (w < x * a[i] || (w - x * a[i]) % (y - x) != 0) {
      cout << "-1\n";
      return 0;
    }
    ans += (w - x * a[i]) / (y - x);
  }
  cout << ans << "\n";
  return 0;
}